#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>

#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main() {
	int fd;
	int n;

	if ((fd=open("/tmp/_x_server_01", O_WRONLY)) < 0) {
		printf("open fifo error: %s\n", strerror(errno));
		return -1;
	}

	char buf[80] = {0};
	while (fgets(buf, 80, stdin) != NULL) {
		if (write(fd, buf, strlen(buf)) < 0) {
			printf("write error: %s\n", strerror(errno));
			return -1;
		}
		memset(buf, 0, 80);
	}

	return 0;
}